#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define N 102

int main()
{
    char bar[N];
    const char *arr = "|/-\\";
    memset(bar,0,sizeof(bar));
    int i = 0;
    while(i <= 50) 
    {
        printf("[%-50s][%d%%] %c\r",bar,i*2,arr[i%4]);
        bar[i++]='#';
        fflush(stdout);
        usleep(50000);
    }
    printf("\n");
    return 0;
}
